package com.hotline.communication.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 白名单vip级别枚举类
 * </p>
 *
 * @author yeshengqi
 * @since 2023-04-23 18:13
 */
public enum VipLevelEnum {

    LEVEL_1(1,"级别1"),
    LEVEL_2(2,"级别2"),
    LEVEL_3(3,"级别3"),
    LEVEL_4(4,"级别4"),
    LEVEL_5(5,"级别5"),
    LEVEL_6(6,"级别6"),
    LEVEL_7(7,"级别7"),
    LEVEL_8(8,"级别8"),
    LEVEL_9(9,"级别9");

    /**
     * 编码
     */
    private Integer code;

    /**
     * 名称
     */
    private String name;


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    VipLevelEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static VipLevelEnum getVipLevelEnum(Integer code){
        for (VipLevelEnum vipLevelEnum : VipLevelEnum.values()){
            if(vipLevelEnum.getCode().equals(code)){
                return vipLevelEnum;
            }
        }
        return null;
    }

    public static List getVipLevelEnumList(){
        List list = new ArrayList();
        for (VipLevelEnum vipLevelEnum : VipLevelEnum.values()){
            Map map = new HashMap<>();
            map.put("code",vipLevelEnum.getCode());
            map.put("name",vipLevelEnum.getName());
            list.add(map);
        }
        return list;
    }

    public static List<String> getVipLevelCodes(){
        List<String> list = new ArrayList();
        for (VipLevelEnum vipLevelEnum : VipLevelEnum.values()){
            list.add(String.valueOf(vipLevelEnum.getCode()));
        }
        return list;
    }
}
